class WelcomeController < ApplicationController
  before_filter :find_all_articles, :only => [:index, :admin]
  # before_filter :authenticate, :only => [:admin]

  def admin
    render :template => "welcome/index"
  end
  
  def list    
    articles = Article.all_by_language(params[:language]) if params[:language]
    articles = Article.find_tagged_with(params[:tag], :match_all => true)
    articles = Category.find(params[:category]).articles if params[:category]
    @articles = articles.paginate :page => params[:page], :per_page => 15, :order => "stickied DESC, id DESC"
    render :template => "welcome/index"
  rescue Exception => e
    redirect_to :action => :index
  end
  
  private 
  
    def find_all_articles
      @articles = Article.paginate_with_default params
    end
        
end
